#include "ros/ros.h"
#include "turtlesim/Pose.h"
#include "test_pkg/person.h"


void poseCallback(const turtlesim::Pose::ConstPtr& msg)
{
    ROS_INFO("Turtle pose: x:%0.6f, y:%0.6f", msg->x, msg->y);
}

void personInfoCallback(const test_pkg::person::ConstPtr& msg)
{
    ROS_INFO("%s, %d, %d", msg->name.c_str(), msg->age, msg->gender);
}

int main(int argc, char **argv)
{
    ros::init(argc, argv, "pose_subscriber");
    
    ros::NodeHandle n;
    ros::NodeHandle p;

    ros::Subscriber pose_sub = n.subscribe("/turtle1/pose", 10, poseCallback);
    ros::Subscriber person_info_sub = p.subscribe("/person_info", 10, personInfoCallback);

    ros::spin(); //等待回调函数

    return 0;
}
